{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    
    <div class="ibox float-e-margins">
        <div class="ibox-content">
            <div class="row">
                <!--搜索框开始-->
                <div class="col-sm-12">
                    <div class="layui-form layui-form-item demoTable">
                        <div class="layui-col-md6 layui-input-inline">
                            <input type="text" id="key" class="layui-input search" name="key" value="" placeholder="手机号"/>
                        </div>
                        <div class="layui-input-inline" style="display: flex;">
                            <button class="layui-btn" lay-submit="" lay-filter="LAY-search">立即搜索</button>
                            <button  class="layui-btn layui-btn-normal" id="empty"  lay-submit="" lay-filter="LAY-search">重置</button>
                            <button class="layui-btn layui-btn-primary" onclick="history.go(-1)" >返回</button>
                        </div>

                    </div>
                </div>
                <!--搜索框结束-->
            </div>
            <div class="hr-line-dashed"></div>

            <div class="example-wrap">
                <div class="example">
                    <table class="layui-hide" id="test" lay-filter="demo"></table>
                    <!--图片模板-->
                    <script type="text/html" id="imgTpl">
                        <img src="{{d.user_image}}" class="img-circle table-img" onerror="this.src='/static/admin/images/head_default.gif'"  />
                    </script>
                    
                    <script type="text/html" id="typeTpl">
                        {{# if(d.o_pay_type == 1){ }}
                        支付宝
                        {{# }else{ }}
                        微信
                        {{# } }}
                    </script>
                    <!--操作模板-->
                    <script type="text/html" id="opeBar">
                        <a class="layui-btn layui-btn-xs" lay-event="details">邀请详情</a>
                    </script>
                    <script type="text/html" id="partner_level">
                    {{#  if(d.par_class_level == 1){ }}
                        <span>推广合伙人</span>
                    {{#  } else if(d.par_class_level == 2) { }}
                        <span>事业合伙人</span>
                    {{#  } else if(d.par_class_level == 3) { }}
                        <span>城市合伙人</span>
                      {{#  } }}
                    </script>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}
<script>
    var par_id = "{$par_id}";
    //layui渲染数据表格
    layui.use('table', function () {
        var table = layui.table
            , form = layui.form;
        table.render({
            elem: '#test'
            , url: '{:url("admin/Partners/partnerchild")}?par_id='+par_id
            ,response: {
                statusCode: 220 //成功的状态码，默认：0
            }
            , page: true
            , size: 'lg' //sm小尺寸的表格 lg大尺寸
            , cellMinWidth: 150
            , limits: [5, 10, 15, 20, 25, 30]
            , limit: "{:config('pages')}"
            , loading: true
            , id: 'testReload'
            , cols: [[
                {type:'numbers', title: '序号'}
                , {field: 'user_image', title: '头像', align: 'center', toolbar: '#imgTpl'}
                , {field: 'user_phone', title: '手机号', align: 'center'}
                , {field: 'par_class_level', title: '合伙人类型', align: 'center',templet:'#partner_level'}
                , {field: 'user_username', title: '用户名', align: 'center'}
                , {field: 'user_balance', title: '收益', align: 'center'}
                , {field: 'district', title: '归属地', align: 'center'}
                , {field: 'par_add_time', title: '加入时间', align: 'center'}
                // , {fixed: 'right', title: '操作', align: 'center'}
            ]]
        });

        // 搜索
        // var $ = layui.$, active = {
        //     reload: function(){
        //         var demoReload = $('#demoReload');

        //         table.reload('test', {
        //             where: {
        //                 keyz: demoReload.val(),
        //             }
        //         });
        //     }
        // };
        // $('.demoTable .layui-btn').on('click', function(){
        //     var type = $(this).data('type');
        //     active[type] ? active[type].call(this) : '';
        // });
    });
    function check(o_id) {
        layer.confirm('提现审核是否通过?', {
            icon: 3,
            title:'提示',
            btn: ['通过', '驳回'],
            btn2:function(index){
                send(o_id,4);
                layer.close(index);
            }}, function(index){
            send(o_id,2);
            layer.close(index);
        });
    }
    function send(o_id,type){
        $.ajax({
            url: "{:url('tixian')}",
            type: "post",
            dataType: "json",
            data: {o_id:o_id,type:type},
            success: function (res) {
                if(res.code == 200){
                    layer.msg(res.msg,{icon:1,time:1500,shade: 0.1},function(){
                        //重载当前页表格
                        $(".layui-laypage-btn").click();
                    });
                } else if (res.code == 100){
                    layer.msg(res.msg,{icon:2,time:1500,shade: 0.1},function () {
                        //重载当前页表格
                        $(".layui-laypage-btn").click();
                    });
                }
            }
        });
    }
</script>
</body>
</html>